package com.billing.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.billing.model.dao.ManagerUsersBeanMapper;
import com.billing.model.dao.UserBeanMapper;
import com.billing.model.dao.UserBufferBeanMapper;
import com.billing.model.entity.ManagerUsersBean;
import com.billing.model.entity.TUser;
import com.billing.model.entity.TUserBuffer;
import com.billing.service.UserBufferService;
import com.billing.service.UserService;

@Service
public class UserBufferServiceImpl implements UserBufferService {
	@Resource
	private UserBufferBeanMapper userCopyBeanMapper;
	
	public List<TUserBuffer> selectTUserList(String name, String dept, Long starttime, Long endtime, String jobnumber,
			int organizationid,int currentPage, int pageSize) {
		return userCopyBeanMapper.selectTUserList(name, dept, starttime, endtime, jobnumber,organizationid, currentPage, pageSize);
	}
	public int selectTUserNum(String name, String dept, Long starttime, Long endtime, String jobnumber,
			int organizationid) {
		return userCopyBeanMapper.selectTUserNum(name, dept, starttime, endtime, jobnumber,organizationid);
	}
	public TUserBuffer selectTUserId(String id) {
		return userCopyBeanMapper.selectTUserId(id);
	}
	public int updateTUser(TUserBuffer user) {
		return userCopyBeanMapper.updateTUser(user);
	}
	public int insertTUser(TUserBuffer user) {
		return userCopyBeanMapper.insertTUser(user);
	}
	public int deleteTUser(int id) {
		return userCopyBeanMapper.deleteTUser(id);
	}
	public TUserBuffer getTUser(String loginname, String password) {
		return userCopyBeanMapper.getTUser(loginname, password);
	}
	public TUserBuffer selectTUserPayId(String id) {
		return userCopyBeanMapper.selectTUserPayId(id);
	}
	public TUserBuffer getTUserById(String id) {
		return userCopyBeanMapper.getTUserById(id);
	}
	@Override
	public TUserBuffer getTSubsidyById(String id) {
		return userCopyBeanMapper.getTSubsidyById(id);
	}
	@Override
	public boolean userMobileIsExist(String mobile,String orgid,String userid) {
		int count = userCopyBeanMapper.countMobileOnOrgid(mobile, orgid,userid);
		int count2 = userCopyBeanMapper.countMobileNotArchiving(mobile, orgid);
		if(count > 0 || count2 > 0){
			return true;
		}
		return false;
	}
	@Override
	public boolean userIdcardIsExist(String idcard, String orgid,String userid) {
		int count = userCopyBeanMapper.countIdcardOnOrgid(idcard, orgid,userid);
		int count2 = userCopyBeanMapper.countIdcardNotArchiving(idcard, orgid);
		if(count > 0 || count2 > 0){
			return true;
		}
		return false;
	}
	@Override
	public List<TUserBuffer> selectTUserLoginnameList(String loginname,
			int organizationid, int currentPage, int pageSize) {
		return userCopyBeanMapper.selectTUserLoginnameList(loginname, organizationid, currentPage, pageSize);
	}
	@Override
	public int selectTUserLoginnameNum(String loginname, int organizationid) {
		return userCopyBeanMapper.selectTUserLoginnameNum(loginname, organizationid);
	}
	@Override
	public int insertTUserByUser(TUser user) {
		return userCopyBeanMapper.insertTUserByUser(user);
	}
	@Override
	public int updateTUserByUser(TUser user) {
		return userCopyBeanMapper.updateTUserByUser(user);
	}
}
